package com.ikas.autumn.iec104.module.protocol;


import com.ikas.autumn.iec104.module.protocol.handler.ProtocolHandler;
import com.ikas.autumn.iec104.module.protocol.handler.ProtocolHandlerFactory;

/**
 * 协议管理
 * @author wu.yunfeng
 */
public class ProtocolContext {

    private ProtocolContext() {
    }

    public static void start(){
        stopProtocol();
        clearProtocol();
        initConnect();
    }

    public static void stopProtocol(){
        //各协议handler清除
        ProtocolHandlerFactory.list(ProtocolHandler::stop);
    }

    public static void clearProtocol(){
        //各协议handler清除
        ProtocolHandlerFactory.list(ProtocolHandler::clear);
    }

    /**
     * 测点数据统一管理
     */
    public static void initConnect(){
        ProtocolHandlerFactory.list(ProtocolHandler::initConnect);
    }

}
